package com.ysd.lis.controller.lab;


import com.ysd.common.Result;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabMaininfoXsReason;
import com.ysd.lis.request.AddAndUpdateCancleauditReason;
import com.ysd.lis.request.DeleteParam;
import com.ysd.lis.service.lab.LabMaininfoXsReasonService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 消审原因内容表 前端控制器
 * </p>
 *
 * @author Bai
 * @since 2024-02-02
 */
@RestController
@RequestMapping("/lab/cancleaudit/reason")
public class LabMaininfoReasonController extends BaseController {
    @Autowired
    LabMaininfoXsReasonService labMaininfoXsReasonService;

    //获取不合规信息
    @ApiOperation("获取消审原因信息（不分页)")
    @GetMapping("/getCancleauditReasonList")
    public Result getCancleauditReasonList(LabMaininfoXsReason labUnqualifiedReason) {
        return labMaininfoXsReasonService.getCancleauditReasonList(labUnqualifiedReason);
    }

    //新增消审原因组信息
    @ApiOperation("新增消审原因信息")
    @PostMapping("/add")
    @LogDetail(requestParam = "add", operationType = OperationType.INSERT, module = "消审原因管理", content = "通过检验模块，使用消审原因设置功能新增了：【reasons】消审原因")
    public Result addGroup(@RequestBody AddAndUpdateCancleauditReason addAndUpdateUnqualiReason) {
        return labMaininfoXsReasonService.add(addAndUpdateUnqualiReason);
    }

    @ApiOperation("修改消审原因信息")
    @PostMapping("/update")
    @LogDetail(requestParam = "update", operationType = OperationType.UPDATE, module = "消审原因管理", content = "通过检验模块，使用消审原因设置功能修改了：【reasons】消审原因")
    public Result update(@RequestBody AddAndUpdateCancleauditReason addAndUpdateUnqualiReason) {
        return labMaininfoXsReasonService.update(addAndUpdateUnqualiReason);
    }

    @ApiOperation("删除消审原因信息")
    @PostMapping("/dalete")
    @LogDetail(requestParam = "dalete", operationType = OperationType.UPDATE, module = "消审原因管理", content = "通过检验模块，使用消审原因设置功能删除了：【names】消审原因")
    public Result daleteGroup(@RequestBody DeleteParam deleteParam) {
        return labMaininfoXsReasonService.dalete(deleteParam);
    }

    //    获取消审组与消审原因列表
    @ApiOperation("获取消审组与消审原因列表（不分页)")
    @GetMapping("/getCancleauditList")
    public Result getUnqualifiedList(LabMaininfoXsReason labUnqualifiedReason) {
        return labMaininfoXsReasonService.getCancleauditList(labUnqualifiedReason);
    }

}
